<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Albums extends MY_Controller {

    public function __construct() {
        parent::__construct();
        
        //Load albums model
        $this->load->model('albums_m');
    }

    /**
     * Default function
     */
    public function index($id) {
        if(empty($id)){
            $id = 1;
        }
        
        //get albumDetail
        $albumDetail = $this->albums_m->get_album_detail($id);
        
        //get all photos
        $arrPhotos = $this->albums_m->get_photos_by_album($id);
        
        //Assign to view
        $this->assign('albumDetail', $albumDetail);
        $this->assign('arrPhotos', $arrPhotos);
        
        //Append CSS stylesheet
        $this->addStylesheet(base_url() . 'static/css/gallery.css');
        //Append Javascript
        $this->addHeadScript(base_url() . 'static/js/gallery.full.js');
    }

}